<?php

$this->breadcrumbs = array(
	$model->label(2) => array('index'),
	Yii::t('app', 'Manage'),
);

$this->menu = array(
array('label'=>'New', 'url'=>array('create'),
'linkOptions'=> array('class' => 'icon icon-plus-circle2 tb-gray'),
),
array('label'=>'Export to Excel', 'url'=>array('excelexport'),
'linkOptions'=> array('class' => 'icon icon-download5 tb-gray'),
),
array('label'=>'Print to PDF', 'url'=>array('pdfexport'),
'linkOptions'=> array('class' => 'icon icon-printer2 tb-gray'),
),

);

?>

<h2 class="form-header">
    <?php
    echo CHtml::encode($this->pageTitle);

    $pageSize=Yii::app()->user->getState('pageSize',Yii::app()->params['defaultPageSize']);
    $pagesizehtml = CHtml::dropDownList(
        'pageSize',$pageSize,BCApp::GetPageSizeArray(),
        array(
            'onchange'=>"$.fn.yiiGridView.update('user-grid',{ data:{pageSize: $(this).val() }})",
        )
    );

    echo "<div class=\"page-size\">Results per page: ".$pagesizehtml."</div>";
    ?>

</h2>

<?php 

$pageSize=Yii::app()->user->getState('pageSize',Yii::app()->params['defaultPageSize']);

$this->widget('zii.widgets.grid.CGridView', array(
	'id' => 'drill-grid',
	'dataProvider' => $model->search(),
	'filter' => $model,
    'summaryText' => '',
  'pager' => Array(
    'firstPageLabel'=>'<<',
    'prevPageLabel'=>'<',
    'nextPageLabel'=>'>',
    'lastPageLabel'=>'>>',
),
  'selectionChanged'=>"function(id){window.location='" . Yii::app()->urlManager->createUrl('Drill/view', array('id'=>'')) . "' + $.fn.yiiGridView.getSelection(id);}",
	'columns' => array(
		'name',
		array(
				'name'=>'category',
				'value'=>'GxHtml::valueEx($data->category0)',
				'filter'=>GxHtml::listDataEx(DrillCategory::model()->findAllAttributes(null, true)),
				),
		'players',
//		'youtube_id',
		array(
				'name'=>'author_id',
				'value'=>'GxHtml::valueEx($data->author)',
				'filter'=>GxHtml::listDataEx(User::model()->findAllAttributes(null, true)),
				),
	),
)); ?>